<%@page import="com.logistics.database.Distributiondatabase"%>
<%@page import="java.sql.ResultSet"%>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>Substationquery</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	
	<script type="text/javascript" src="scripts/jquery/jquery-1.7.1.js"></script>
	<link href="style/authority/basic_layout.css" rel="stylesheet" type="text/css">
	<link href="style/authority/common_style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="scripts/authority/commonAll.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.js"></script>
	<script type="text/javascript" src="scripts/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="style/authority/jquery.fancybox-1.3.4.css" media="screen"></link>
	<script type="text/javascript" src="scripts/artDialog/artDialog.js?skin=default"></script>
	<script type="text/javascript" src="scripts/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript" src="scripts/Myscripts/alpha_add.js"></script>
	
  </head>
  <body>
  	 <script type="text/javascript">
  	 var req = false;
  	 function createRequest()
  	 {
  	 	if(window.XMLHttpRequest)
  	 	{
  	 		req = new XMLHttpRequest();
  	 	}
  	 	else if(window.ActiveXObject)
  	 	{
  	 		req = new  ActiveXObject("Microsoft.XMLHTTP");
  	 	}
  	 	if(!req)
  	 	{
  	 		alert("Error Initializing XMLHttpRequest!");
  	 	}
  	 }
  	 function processDate()
  	 {
  	 	//alert("!");
  	 	createRequest();
  	 	//alert("!!!");
  	 	var begin_time = document.getElementById("begin_time_id").value;
  	 	var end_time=document.getElementById("end_time_id").value;
  	 	if(begin_time!=""&&begin_time!=null&&end_time!=null&&end_time!="")
  	 	{
  	 	var url = "distribution/Getmissionbydate.jsp?begin_time=" +encodeURI(encodeURI(begin_time))+"&end_time="+encodeURI(encodeURI(end_time));
  	 	req.open("get", url, true);
  	 	req.onreadystatechange = updatePage;
  		req.send(null);
  		}
  		else{
  		//alert("请填全时间！");
  		}
  	 }
  	 function updatePage(){
  	 //alert(req.readyState);
  	 	if(req.readyState==4)
  	 	{
  	 	//alert(req.status);
  	 		if(req.status==200)
  	 		{
  	 			var res = req.responseText.split(",");
  	 			//alert(req.responseText);
  				document.getElementById("mission_sum_id").value=res[0];
  				document.getElementById("product_sum_id").value=res[1];
  				document.getElementById("money_sum_id").value=res[2];
  	 			alert("已更新！");
  	 		}
  	 	}
  	 }
  	  function beforeprocessDate()
  	  {
  	  	var begin_time = document.getElementById("begin_time_id").value;
  	 	var end_time=document.getElementById("end_time_id").value;
  	 	if(begin_time!=""&&begin_time!=null&&end_time!=null&&end_time!="")
  	 	{
  	  		processDate();
  	  	}
  	  	else
  	  	{
  	  		alert("请填全信息！");
  	  	}
  	  }
  	 </script>
  	 <div id = "add_alpha_id">
  	 <div id="container">
  	 <div class="ui_content">
  	    <div id="box_border">	
  	     <div id = "box_top">搜索</div>
  	     <div id = "box_center" >
  				<table class = "table" width="100%">
  					<tr><td width="100px" align ="center">开始时间：</td><td><input type="text" id="begin_time_id" onblur="processDate()" class="ui_input_txt02" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,maxDate:'#F{$dp.$D(\'end_time_id\')}'})"/></td>
  					<td width="100px" align ="center">结束时间：</td><td><input type="text" id="end_time_id" onblur="processDate()" class="ui_input_txt02" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',readOnly:true,minDate:'#F{$dp.$D(\'begin_time_id\')}',startDate:'#F{$dp.$D(\'begin_time_id\',{d:+1})}'})"/></td></tr>
  				</table>
  				</div>
  		 <div id = "box_bottom"> <input type="button" value = "确定" class="ui_input_btn01" onclick="beforeprocessDate()"></div>
  	 </div>
  	  <div class="ui_content">
  	 	 <div id="box_border">
  			<table class = "table" width="100%">
  				<tr><th align="center">完成任务数</th><th align="center">送货总数</th><th align="center">送货总金额</th></tr>
  				<tr><td><input type="text" id="mission_sum_id" readonly class="ui_input_txt02"/></td><td><input type="text" id="product_sum_id" readonly class="ui_input_txt02"/></td><td><input type="text" id="money_sum_id" readonly class="ui_input_txt02"/></td></tr>
  			</table>
  			</div>
  		 </div>
  		</div>
  	</div>
  	</div>
  	<script type="text/javascript">
   var eitem = document.getElementById("add_alpha_id");
   window.onload = add_alpha(eitem);
   </script>
  </body>
</html>
